package org.syndicate.domain;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.transaction.annotation.Transactional;

/**
 * Transaction of fee payment.
 * 
 * @author akiraabe
 */
@RooJavaBean
@RooToString
@RooEntity(inheritanceType = "JOINED")
public class FeePayment extends AbstractTransaction {

	/**
	 * {@inheritDoc}
	 * <br/>Borrower pays fee for facility.
	 */
	@Transactional
	@Override
	public AbstractPosition execute() {
		
		System.out.println("FeePayment#execute");

		this.setDiscriminator("FeePayment");
		
		// Find existing Facility
		Facility facility = Facility.findBySharePie(this.getSharePie());
		facility.apply(this);
		
		return facility;

	}
}
